import type { Plugin } from "../../core";
import type {
  EnterFullScreenMenuItemProps,
  EnterFullScreenProps,
  FullScreenPlugin,
  FullScreenPluginProps,
} from "../full-screen";
import type {
  DownloadMenuItemProps,
  DownloadProps,
  DownloadPlugin,
  DownloadPluginProps,
} from "../download";
import type { OpenPlugin, OpenProps } from "../open";
import type {
  CurrentPageLabelProps,
  GoToPageProps,
  GoToPageMenuItemProps,
  PageNavigationPlugin,
} from "../page-navigation";
import type {
  PrintMenuItemProps,
  PrintPlugin,
  PrintPluginProps,
  PrintProps,
} from "../print";
import type {
  PropertiesPlugin,
  ShowPropertiesProps,
  ShowPropertiesMenuItemProps,
} from "../properties";
import type {
  RotateDecoratorProps,
  RotatePlugin,
  RotateProps,
} from "../rotate";
import type {
  ScrollModePlugin,
  ScrollModePluginProps,
  SwitchScrollModeMenuItemProps,
  SwitchScrollModeProps,
} from "../scroll-mode";
import type {
  SearchPlugin,
  SearchPluginProps,
  SearchProps,
  ShowSearchPopoverProps,
} from "../search";
import type {
  SelectionModePlugin,
  SelectionModePluginProps,
  SwitchSelectionModeMenuItemProps,
  SwitchSelectionModeProps,
} from "../selection-mode";
import type {
  SwitchThemeProps,
  SwitchThemeMenuItemProps,
  ThemePlugin,
} from "../theme";
import type {
  CurrentScaleProps,
  ZoomInProps,
  ZoomMenuItemProps,
  ZoomOutProps,
  ZoomPlugin,
  ZoomPluginProps,
  ZoomProps,
} from "../zoom";
import { ReactElement } from "react";

export interface ToolbarSlot {
  CurrentPageInput(): ReactElement;
  CurrentPageLabel(props: CurrentPageLabelProps): ReactElement;
  CurrentScale(props: CurrentScaleProps): ReactElement;
  GoToFirstPage(props: GoToPageProps): ReactElement;
  GoToFirstPageMenuItem(props: GoToPageMenuItemProps): ReactElement;
  GoToLastPage(props: GoToPageProps): ReactElement;
  GoToLastPageMenuItem(props: GoToPageMenuItemProps): ReactElement;
  GoToNextPage(props: GoToPageProps): ReactElement;
  GoToNextPageMenuItem(props: GoToPageMenuItemProps): ReactElement;
  GoToPreviousPage(props: GoToPageProps): ReactElement;
  GoToPreviousPageMenuItem(props: GoToPageMenuItemProps): ReactElement;
  NumberOfPages(): ReactElement;

  Download(props: DownloadProps): ReactElement;
  DownloadMenuItem(props: DownloadMenuItemProps): ReactElement;

  EnterFullScreen(props: EnterFullScreenProps): ReactElement;
  EnterFullScreenMenuItem(props: EnterFullScreenMenuItemProps): ReactElement;

  Open(props: OpenProps): ReactElement;
  OpenMenuItem(): ReactElement;

  Print(props: PrintProps): ReactElement;
  PrintMenuItem(props: PrintMenuItemProps): ReactElement;

  Rotate(props: RotateProps): ReactElement;
  RotateBackwardMenuItem(props: RotateDecoratorProps): ReactElement;
  RotateForwardMenuItem(props: RotateDecoratorProps): ReactElement;

  Search(props: SearchProps): ReactElement;
  ShowSearchPopover(props: ShowSearchPopoverProps): ReactElement;

  ShowProperties(props: ShowPropertiesProps): ReactElement;
  ShowPropertiesMenuItem(props: ShowPropertiesMenuItemProps): ReactElement;

  SwitchScrollMode(props: SwitchScrollModeProps): ReactElement;
  SwitchScrollModeMenuItem(props: SwitchScrollModeMenuItemProps): ReactElement;
  SwitchSelectionMode(props: SwitchSelectionModeProps): ReactElement;
  SwitchSelectionModeMenuItem(
    props: SwitchSelectionModeMenuItemProps
  ): ReactElement;

  SwitchTheme(props: SwitchThemeProps): ReactElement;
  SwitchThemeMenuItem(props: SwitchThemeMenuItemProps): ReactElement;

  Zoom(props: ZoomProps): ReactElement;
  ZoomIn(props: ZoomInProps): ReactElement;
  ZoomInMenuItem(props: ZoomMenuItemProps): ReactElement;
  ZoomOut(props: ZoomOutProps): ReactElement;
  ZoomOutMenuItem(props: ZoomMenuItemProps): ReactElement;
}

export interface ToolbarProps {
  children?: (toolbarSlot: ToolbarSlot) => ReactElement;
}

export interface MoreActionsPopoverProps {
  toolbarSlot: ToolbarSlot;
}

export interface ToolbarPlugin extends Plugin {
  Toolbar: (props: ToolbarProps) => ReactElement;
  // Plugins instance
  fullScreenPluginInstance: FullScreenPlugin;
  downloadPluginInstance: DownloadPlugin;
  openPluginInstance: OpenPlugin;
  pageNavigationPluginInstance: PageNavigationPlugin;
  printPluginInstance: PrintPlugin;
  propertiesPluginInstance: PropertiesPlugin;
  rotatePluginInstance: RotatePlugin;
  scrollModePluginInstance: ScrollModePlugin;
  searchPluginInstance: SearchPlugin;
  selectionModePluginInstance: SelectionModePlugin;
  themePluginInstance: ThemePlugin;
  zoomPluginInstance: ZoomPlugin;
}

export interface ToolbarPluginProps {
  fullScreenPlugin?: FullScreenPluginProps;
  downloadPlugin?: DownloadPluginProps;
  printPlugin?: PrintPluginProps;
  scrollModePlugin?: ScrollModePluginProps;
  searchPlugin?: SearchPluginProps;
  selectionModePlugin?: SelectionModePluginProps;
  zoomPlugin?: ZoomPluginProps;
}
